package com.keduw.utils;

/**
 * 首字符转化工具
 * @author hongshengfeng
 * @date 2020/09/14
 */
public class CharsetUtils {

    /**
     * 首字母变小写
     * @param s
     * @return
     */
    public static String toLowerCase(String s){
        if(Character.isLowerCase(s.charAt(0))){
            return s;
        } else{
            StringBuilder builder = new StringBuilder();
            builder.append(Character.toLowerCase(s.charAt(0)));
            builder.append(s.substring(1));
            return builder.toString();
        }
    }


    /**
     * 首字母转大写
     * @param s
     * @return
     */
    public static String toUpperCase(String s){
        if(Character.isUpperCase(s.charAt(0))){
            return s;
        } else{
            StringBuilder builder = new StringBuilder();
            builder.append(Character.toUpperCase(s.charAt(0)));
            builder.append(s.substring(1));
            return builder.toString();
        }
    }
}
